import { createBrowserRouter } from 'react-router-dom'
import App from '../App'

const routes = createBrowserRouter([
    {
        path: '/',
        element: <App></App>,
        children: [
            {
                index: true,
                lazy: async () => {
                    const { default: Index } = await import('../pages/index/Index')
                    return {
                        element: <Index></Index>
                    }
                }
            },
            {
                path: 'index',
                lazy: async () => {
                    const { default: Index } = await import('../pages/index/Index')
                    return {
                        element: <Index></Index>
                    }
                }
            },
            {
                path: 'message',
                lazy: async () => {
                    const { default: Message } = await import('../pages/message/Index')
                    return {
                        element: <Message></Message>
                    }
                }
            },
            {
                path: 'order',
                lazy: async () => {
                    const { default: Order } = await import('../pages/order/Index')
                    return {
                        element: <Order></Order>
                    }
                }
            },
            {
                path: 'my',
                lazy: async () => {
                    const { default: My } = await import('../pages/my/Index')
                    return {
                        element: <My></My>
                    }
                }
            },
        ]
    },
    {
        path: '/list',
        lazy: async () => {
            const { default: List } = await import('../pages/list/Index')
            return {
                element: <List></List>
            }
        }
    }
])
export default routes